﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using OrganizedIN.BAL;
using OrganizedIN.BussinessServices;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
namespace OrganizedIN.UI.Document
{
    public partial class Search_Document : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //lblusername.Text=Convert.ToString(Session["username"]);
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                string strPriority = String.Empty;
                string strRating = String.Empty;
                BLL objbll = new BLL();
                string strUserName = Session["UserID"].ToString();

                MyProfileDocument objMyDoc = new MyProfileDocument();
                objMyDoc.DocumentSummary = txtsrchbytitle.Text;
                objMyDoc.DocumentCreateDate = txtsrchbydate.Text;
                string strSort = ddlsort.SelectedValue.ToString();

                if (ddlPriority.SelectedValue.ToString() == "0")
                {
                    strPriority = "";
                }
                else
                {
                    strPriority = ddlPriority.SelectedItem.Text;
                }
                if (ddlsrchrating.SelectedValue.ToString() == "0")
                {
                    strRating = "";
                }
                else
                {
                    strRating = ddlsrchrating.SelectedItem.Text;
                }

                DataSet ds = new DataSet();
                ds = objbll.ProfileDocSearch(strUserName, objMyDoc.DocumentSummary, objMyDoc.DocumentCreateDate, strPriority, strRating, strSort);
                dgSearchResult.DataSource = ds.Tables[0];
                dgSearchResult.DataBind();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblErrMsg.Text = "";
                }
                else
                {
                    lblErrMsg.Text = "No record(s) found.";
                }
            }
            catch (Exception ex)
            {
            }
        }


    }
}
